#pragma once
#include "Infra/Thread.h"
#include "decisionLevel.h"
#include <opencv2/opencv.hpp>
#include "string"

using namespace Dahua::Infra;
using namespace cv;
using namespace std;


#define POSITIVE_SAMPLE_PATH   "TrainData/positive/"
#define NEGATIVE_SAMPLE_PATH   "TrainData/negative/"
#define AUTO_SAVE_TRUE_SAMPLE_PATH  "TrainData/autoSaveSample/true/"
#define AUTO_SAVE_FALSE_SAMPLE_PATH  "TrainData/autoSaveSample/false/"

#define SAVE_INTERVAL_TIME  1.0f
#define SAVE_SAMPLE_MODE	SAVE_DISABLE

typedef enum {
	SAVE_DISABLE = 0,
	MANULE_SAVE,
	AUTO_SAVE
}saveSampleMode_e;

class AutoSaveSample {
public:
	AutoSaveSample(DecisionLevelPtr & DecisionLevelPtr, uint8_t mode = 0);
	void setSampleData(struct sampleDataStruct & sampleData) {
		sampleData_ = sampleData;
	}
	void threadProc();
private:
	bool saveSamplesReady();
	struct sampleDataStruct sampleData_;
	cv::Mat outImage_;	
	bool taskInit = false;
	double saveTime_;
	void getImgSampleSize();
	void manuleSaveSample(const struct sampleDataStruct & sampleData);
	void autoSaveSample(const struct sampleDataStruct & sampleData);
	DecisionLevelPtr decisionLevelPtr;

	uint32_t _savePositiveNumber = 0;
	uint32_t _saveNegativeNumber = 0;
	uint32_t _autoSaveTrueNumber = 0;
	uint32_t _autoSaveFalseNumber = 0;
	saveSampleMode_e _saveSampleMode = SAVE_SAMPLE_MODE;

	string _positiveSamplePath = POSITIVE_SAMPLE_PATH;
	string _negativeSamplePath = NEGATIVE_SAMPLE_PATH;
	string _autoSaveTrueSamplePath = AUTO_SAVE_TRUE_SAMPLE_PATH;
	string _autoSaveFalseSamplePath = AUTO_SAVE_FALSE_SAMPLE_PATH;

};

